package com.dyit.service.impl;

import com.dyit.entity.Book;
import com.dyit.mapper.IBookMapper;
import com.dyit.service.IBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class BookServiceImpl implements IBookService {

    @Autowired
    private IBookMapper ibm;

    @Override
    public boolean add(Book book) {
        boolean save = ibm.save(book);
        return save;
    }

    @Override
    public void deleteById(int id) {
        ibm.delete(id);
    }

    @Override
    public void update(Book book) {
        ibm.update(book);
    }

    @Override
    public List<Book> findAll() {
        return ibm.findAll();
    }
}
